﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BOSS.Domain.Security
{
    /// <summary>
    /// 抽象特权设置类
    /// </summary>
    [Serializable]
    public abstract class AbstractPrivilegeSetting<T> : Entity<int>, IPrivilegeSetting where T : IPrivilegeContainer
    {
        /// <summary>
        /// 获取 / 设置 容器
        /// </summary>
        protected T Container { get; set; }

        #region IPrivilegeSetting 成员

        /// <summary>
        /// 获取 / 设置 特权名称
        /// </summary>
        public virtual string PrivilegeName { get; set; }

        /// <summary>
        /// 获取 / 设置 特权许可状态
        /// </summary>
        public virtual PermissionType Permission { get; set; }

        #endregion

        /// <summary>
        /// 获取文字串
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return string.Format("{0} - {1} = {2}", this.Container, this.PrivilegeName, this.Permission);
        }
    }
}
